home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / OUTFILE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  620 b   |  24 lines

  1. /* outfile.c - write out sorted file */
  2. #include   "stdio.h"
  3. #include   "sorttext.h"
  4.  
  5. FILE *do_open() ;
  6.  
  7. int  outfile(prec,nrec,oname)
  8.   char    *prec[] ;        /* array of pointers to records */
  9.   int    nrec  ;         /* number of records to be output */
  10.   char    oname[] ;        /* output file name */
  11.   {
  12.      int i ;
  13.      FILE  *ofile ;        /* output runs this file */
  14.  
  15.      ofile = do_open(oname,"w") ;       /*open output merge file */
  16.  
  17.      for(i=1 ; i<nrec ; i=i+1)    /* write records in sorted order */
  18.     {  putrec(prec[i],ofile) ; }    /* output one record */
  19.  
  20.      do_close(ofile,oname) ;    /* close the file */
  21.   }
  22.  
  23.  
  24.